/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.wyota.transform.v20210420;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.wyota.model.v20210420.ListTrustDevicesResponse;
import com.aliyuncs.wyota.model.v20210420.ListTrustDevicesResponse.TrustedDeviceDTOList;
import com.aliyuncs.transform.UnmarshallerContext;


public class ListTrustDevicesResponseUnmarshaller {

	public static ListTrustDevicesResponse unmarshall(ListTrustDevicesResponse listTrustDevicesResponse, UnmarshallerContext _ctx) {
		
		listTrustDevicesResponse.setRequestId(_ctx.stringValue("ListTrustDevicesResponse.RequestId"));
		listTrustDevicesResponse.setCode(_ctx.stringValue("ListTrustDevicesResponse.Code"));
		listTrustDevicesResponse.setMessage(_ctx.stringValue("ListTrustDevicesResponse.Message"));

		List<TrustedDeviceDTOList> data = new ArrayList<TrustedDeviceDTOList>();
		for (int i = 0; i < _ctx.lengthValue("ListTrustDevicesResponse.Data.Length"); i++) {
			TrustedDeviceDTOList trustedDeviceDTOList = new TrustedDeviceDTOList();
			trustedDeviceDTOList.setUuid(_ctx.stringValue("ListTrustDevicesResponse.Data["+ i +"].Uuid"));
			trustedDeviceDTOList.setSerialNo(_ctx.stringValue("ListTrustDevicesResponse.Data["+ i +"].SerialNo"));
			trustedDeviceDTOList.setTenantId(_ctx.stringValue("ListTrustDevicesResponse.Data["+ i +"].TenantId"));
			trustedDeviceDTOList.setModel(_ctx.stringValue("ListTrustDevicesResponse.Data["+ i +"].Model"));

			data.add(trustedDeviceDTOList);
		}
		listTrustDevicesResponse.setData(data);
	 
	 	return listTrustDevicesResponse;
	}
}